<?php namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Technologies extends Model {

	//
	protected $table = 'technologies';
	protected $fillable = ['tech_name', 'developer', 'theory', 'advantage', 'advantage_des', 'score', 'image', 'description', 'theory_des', 'typical_client', 'uid', 'efficiency', 'verify_state'];

	public function user()
	{
		return $this->hasOne("App\Models\Users", "id", "uid");
	}

	public function techDomain()
	{
		return $this->hasOne("App\Models\TechDomain", "tech_id", "id");
	}

	public function techCases()
	{
		return $this->hasMany("App\Models\TechCase", "tech_id", "id");
	}

	public function techTech()
	{
		return $this->hasOne("App\Models\TechTech", "tech_id", "id");
	}

	public function techScope()
	{
		return $this->hasOne("App\Models\TechSope", "tech_id", "id");
	}

	public function techProject()
	{
		return $this->hasMany("App\Models\ProjectTechnologies", "tech_id", "id");
	}

	public function mainbody()
	{
		return $this->hasMany("App\Models\TechMainBody", "tech_id", "id");
	}

	public function finance()
	{
		return $this->hasOne("App\Models\Financing", "related_id", "id")->where("type", env("FINANCING_TECH"));
	}
}
